﻿using System.Windows;

namespace BeeCoders.Tools.Wpf.PdfCanvas.Converters
{
	public class PdfConverterBase
	{
		//public Point PointToWindow(UIElement element, Point pdfCanvasOrigin, Point pointOnElement)
		//{
		//    Window wnd = Window.GetWindow(element);
		//    if (wnd == null)
		//    {
		//        throw new InvalidOperationException("target element is not yet connected to the Window drawing surface");
		//    }
		//    Point p = element.TransformToAncestor(wnd).Transform(pointOnElement);

		//    p = new Point(p.X - pdfCanvasOrigin.X, p.Y - pdfCanvasOrigin.Y);

		//    return p;
		//}

		public Point PointToWindow(PdfCanvas canvas, UIElement element, Point pointOnElement)
		{
			Point p = element.TransformToAncestor(canvas).Transform(pointOnElement);

			p = new Point(p.X, p.Y);

			return p;
		}

		public PdfConverterBase()
		{

		}
	}
}
